/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tces.view;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.tces.controller.CategoryDAO;
import com.tces.controller.QuestionDAO;
import com.tces.model.Question;
import com.tces.model.Student;
import java.util.List;
import org.apache.log4j.Logger;

/**
 *
 * @author arnolda
 */
public class QuestionAction extends ActionSupport {

    private static final Logger log = Logger.getLogger(CategoryAction.class);
    private List<Question> questionList;
    private Student student;
    private String categoryID;

    public String viewCategoryQuestions() {
        try {
            log.info("Category ID:" + categoryID);
            student = (Student) ActionContext.getContext().getSession().get("student");
            questionList = QuestionDAO.getActiveQuestions(Integer.parseInt(categoryID));

        } catch (Exception ex) {
            log.error(ex);

        }
        return SUCCESS;
    }

    public String getCategoryID() {
        return categoryID;
    }

    public void setCategoryID(String categoryID) {
        this.categoryID = categoryID;
    }

    public List<Question> getQuestionList() {
        return questionList;
    }

    public void setQuestionList(List<Question> questionList) {
        this.questionList = questionList;
    }
}